package com.fengxing.ams.web.facade.mouble.user;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;

public interface IRoleDAO extends PagingAndSortingRepository<RoleVO, Long>, JpaSpecificationExecutor<RoleVO> {
	/**
	 * find role by role name
	 * 
	 * @param name
	 * @return
	 */
	RoleVO findByName(String name);
	
	/**
	 * count by role id
	 * 
	 * @param roleId
	 * @return
	 */
	@Query("select r.userList.size from RoleVO r where r.role_id = :role_id")
	int countByRoleId(@Param("role_id") Long roleId);
}
